<p>Swift has several operators that perform comparison, and these work more or less like you would expect in mathematics.</p>
<p>Let’s start with a couple of example variables so we have something to work with:</p>
<pre class="code">
<p></p>
<p><span class="keyword">let</span> firstScore <span class="operator">=</span> <span class="number">6</span></p>
<p><span class="keyword">let</span> secondScore <span class="operator">=</span> <span class="number">4</span></p>
<p></p>
</pre>

<p style="height: 0px; margin-bottom: 0px;"></p>
<p>There are two operators that check for equality: <code>==</code> checks two values are the same, and <code>!=</code> (pronounced “not equals”) checks two values are <em>not</em> the same:</p>
<pre class="code">
<p></p>
<p>firstScore <span class="operator">==</span> secondScore</p>
<p>firstScore <span class="operator">!=</span> secondScore</p>
<p></p>
</pre>

<p style="height: 0px; margin-bottom: 0px;"></p>
<p>There are four operators for comparing whether one value is greater than, less than, or equal to another. These are just like in mathematics:</p>
<pre class="code">
<p></p>
<p>firstScore <span class="operator">&lt;</span> secondScore</p>
<p>firstScore <span class="operator">&gt;=</span> secondScore</p>
<p></p>
</pre>

<p style="height: 0px; margin-bottom: 0px;"></p>
<p>Each of these also work with strings, because strings have a natural alphabetical order:</p>
<pre class="code">
<p></p>
<p><span class="string">"Taylor"</span> <span class="operator">&lt;=</span> <span class="string">"Swift"</span></p>
<p></p>
</pre>

<p style="height: 0px; margin-bottom: 0px;"></p>